const { Double } = require('mongodb');
const mongoose = require('mongoose');

const zfSchema = new mongoose.Schema({
  gender: Number,
  ener_married: Number,
  Residence_type: Number,
  work_type: Number,
  bmi: Number,
  height: Number,
  weight: Number,
  hypertension: Number,
  heart_disease: Number,
  avg_glucose_level: Number,
  age: Number,
  advice: String,
  result: Number,
  smoking_status:Number,
  userId: {
    type: String,
    ref: 'users', // 这里假设你有名为 'ZFList' 的关联模型
  }
  ,
  create_time: {
    type: Date,
    default: Date.now, // 设置默认值为当前日期时间
  },
  update_time: {
    type: Date,
    default: Date.now, // 设置默认值为当前日期时间
  },
}, {
  toJSON: {
    virtuals: true,
    transform: (doc, ret) => {
      ret.id = ret._id.toString();
      delete ret._id;
    },
  },
  versionKey: false,
});

const ZF = mongoose.model('ZF', zfSchema);

module.exports = ZF;
